package com.weight.system.project.service.impl;

import com.weight.system.project.PO.FileInfo;
import com.weight.system.project.service.FileInfoService;
import com.weight.system.project.DAO.FileInfoMapper;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import org.springframework.transaction.annotation.Transactional;
import com.weight.common.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * 项目附件信息表
 */
@Service
@Transactional
@Slf4j
public class FileInfoServiceImpl implements FileInfoService {

	@Autowired
	private FileInfoMapper fileInfoMapper;


	/**
	 * 查询项目附件信息信息--条件查询
	 * @param map
	 * @return
	 */
	@Override
	public List<FileInfo> findFileInfoByT(Map map){
		return fileInfoMapper.findFileInfoByT(map);
	}

	/**
	 * 查询项目附件信息信息--条件，分页查询
	 * @param currentPage
	 * @param pageSize
	 * @param map
	 * @return
	 */
	@Override
	public List<FileInfo> findFileInfoByPage(int currentPage,int pageSize,Map map){
		PageHelper.startPage(currentPage, pageSize);
		List<FileInfo> fileInfoList = fileInfoMapper.findFileInfoByT(map);
		return fileInfoList;
	}

	/**
	 * 查询项目附件信息信息--查询全部
	 * @return
	 */
	@Override
	public List<FileInfo> findAll(){
		return fileInfoMapper.findAll();
	}

	/**
	 * ID查询项目附件信息信息
	 * @param map
	 * @return
	 */
	@Override
	public FileInfo findByFileInfoId(Map map){
		FileInfo fileInfo=fileInfoMapper.findByFileInfoId(map);
		CommonUtils.validateExistObj(fileInfo,map);
		return fileInfo;
	}

	/**
	 * ID查询项目附件信息信息-批量
	 * @param fileInfoIdList
	 * @return
	 */
	@Override
	public List findByFileInfoIdList(List fileInfoIdList){
		List idList = fileInfoMapper.findByFileInfoIdList(fileInfoIdList);
		CommonUtils.validateExistList(idList,fileInfoIdList);
		return idList;
	}

	/**
	 * 添加项目附件信息
	 * @param fileInfo
	 */
	@Override
	public void insertFileInfo(FileInfo fileInfo){
		fileInfoMapper.insertFileInfo(fileInfo);
	}

	/**
	 * 批量添加项目附件信息
	 * @param fileInfoList
	 */
	@Override
	public void insertFileInfoBatch(List<FileInfo> fileInfoList){
		fileInfoMapper.insertFileInfoBatch(fileInfoList);
	}

	/**
	 * 修改项目附件信息
	 * @param fileInfo
	 */
	@Override
	public void updateFileInfo(FileInfo fileInfo){
		fileInfoMapper.updateFileInfo(fileInfo);
	}

	/**
	 * 物理删除项目附件信息
	 * @param map
	 */
	@Override
	public void deleteByFileInfoId(Map map){
		fileInfoMapper.deleteByFileInfoId(map);
	}

	/**
	 * 批量物理删除项目附件信息
	 * @param fileInfoIdList
	 */
	@Override
	public void deleteByFileInfoIdBatch(List fileInfoIdList){
		fileInfoMapper.deleteByFileInfoIdBatch(fileInfoIdList);
	}

	/**
	 * 状态删除项目附件信息
	 * @param map
	 */
	@Override
	public void upDelByFileInfoId(Map map){
		fileInfoMapper.upDelByFileInfoId(map);
	}

	/**
	 * 批量状态删除项目附件信息
	 * @param fileInfoList
	 */
	@Override
	public void upDelByFileInfoIdBatch(Map<String, Object> map){
		fileInfoMapper.upDelByFileInfoIdBatch(map);
	}

}